import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
interface Item {
  name: string;
  path: string;
  icon: string;
  // 可以添加更多属性  
}

interface MyState {
  items: Item[];
  tabValue: string;
}
export const useCounterStore = defineStore('counter', {
  state: (): MyState => ({
    items: [],
    tabValue: '个人办公',
  }),
  actions: {
    //导航
    menuclick(item: any) {
      this.$state.tabValue = item
    },
    addCrumbs(item: Item) {
      if (!this.$state.items.find((i) => i.name === item.name)) {
        if(!item.children){
          this.$state.items.push(item);
        }
     
      }
    },
    //删除
    removeCrumbs(index: Number) {
      this.items.splice(index, 1)
    }
  }
});

